home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1994-12-08 | 44.2 KB | 1,235 lines | [ TEXT/R*ch]
C.S.M.P. Digest Mon, 22 Jun 92 Volume 1 : Issue 120 Today's Topics: Getting A5 in VBL tasks How to center Alerts? Fun with FindFolder Think C 4 & 5 SetLineWidth question Image measurement for the Mac ?? Are "virtual" (software) monitors possible? detecting when a volume or floppy is mounted, how? Two questions HOW do I get the finder to update its file information.. Need Graphics Book Rec The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly. These digests are available (by using FTP, account anonymous, your email address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon. edu. This is also the home of the comp.sys.mac.programmer Frequently Asked Questions list. The last several issues of the digest are available from sumex-aim.stanford.edu as well. These digests are also available via email. Just send a note saying that you want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will automatically receive each new digest as it is created. The digest is a collection of articles from the internet newsgroup comp.sys. mac.programmer. It is designed for people who read c.s.m.p. semi-regularly and want an archive of the discussions. If you don't know what a newsgroup is, you probably don't have access to it. Ask your systems administrator(s) for details. (This means you can't post questions to the digest.) The articles in these digests are taken directly from comp.sys.mac.programmer. They are not edited; all articles included in this digest are in their original posted form. The only articles that are -not- included in these digests are those which didn't receive any replies (except those that give information rather than ask a question). All replies to each article are concatenated onto the original article in the order in which they were received. Article threads are not added to the digests until the last article added to the thread is at least one month old (this is to ensure that the thread is dead before adding it to the digests). Send administrative mail to mkelly@cs.uoregon.edu. ------------------------------------------------------- From: anarch@bonaire.dartmouth.edu (The Anarch) Subject: Getting A5 in VBL tasks Date: 13 May 92 00:33:52 GMT Organization: Secular Humanists from Hell Now that SetUpA5 and RestoreA5 should not be used, how are people getting globals in VBL tasks? IM VI doesn't seem to address it. I've read the stuff about using refCons to pass A5, but of course you don't have any refCons for VBL tasks (or do you? Maybe I've missed something). I don't want to use the Time Manager because this is for animation. I can think of one way to do it, storing A5 into the body of the task code, but IM VI *does* mention this approach and discourages it. Any other ideas? - -- +-+-+-+-+-+-+-+-+-+-+-+anarch@bonaire.dartmouth.edu-+-+-+-+-+-+-+-+-+-+-+-+-+ "The Walpurgisnacht has become synonomous with any general revelry, and particularly for the breaking out of demonic lewdness and disorder." D I S C L A I M E R : E V E R Y T H I N G I W R I T E I S F A L S E +++++++++++++++++++++++++++ From: wysocki@husc.harvard.edu (Chris Wysocki) Date: 13 May 92 14:40:23 GMT Organization: Harvard University, Cambridge, MA In article <1992May13.003352.28376@dartvax.dartmouth.edu>, anarch@bonaire.dartmouth.edu (The Anarch) writes: > Now that SetUpA5 and RestoreA5 should not be used, how are people > getting globals in VBL tasks? When a VBL task is called, A0 points to the VBLTask record associated with the VBL task. You can take advantage of this by storing the proper value of A5 just *before* the VBLTask record. In C, you would declare a struct such as: typedef struct { long curA5; VBLTask vbl; } MyVBLTask; and put the current value of A5 in the curA5 field when installing the VBL task. Your VBL task can then get the correct value of A5 from - -4(A0). If it isn't obvious, A5 should be set up in this manner before doing anything that might trash the contents of A0. (All of this is documented in the original "Programmer's Guide to MultiFinder", but it appears that this information didn't make it into the Memory Management chapter in IM VI.) Chris Wysocki wysocki@husc.harvard.edu +++++++++++++++++++++++++++ From: REEKES@applelink.apple.com (Jim Reekes) Date: 17 May 92 01:49:01 GMT Organization: Apple Computer, Inc. In article <1992May13.003352.28376@dartvax.dartmouth.edu>, anarch@bonaire.dartmouth.edu (The Anarch) writes: > > > Now that SetUpA5 and RestoreA5 should not be used, how are people > getting globals in VBL tasks? IM VI doesn't seem to address it. I've read > the stuff about using refCons to pass A5, but of course you don't have > any refCons for VBL tasks (or do you? Maybe I've missed something). I > don't want to use the Time Manager because this is for animation. I can > think of one way to do it, storing A5 into the body of the task code, but > IM VI *does* mention this approach and discourages it. Any other ideas? Read Tech Note 180. It even has the exact code you're asking for. - ----------------------------------------------------------------------- Jim Reekes, Polterzeitgeist | Macintosh Toolbox Engineering | Sound Manager Expert Apple Computer, Inc. | "All opinions expressed are mine, and do 20525 Mariani Ave. MS: 81-KS | not necessarily represent those of my Cupertino, CA 95014 | employer, Apple Computer Inc." --------------------------- From: jryan@adobe.com (Jim Ryan) Subject: How to center Alerts? Date: 12 May 92 20:43:11 GMT Organization: Adobe Systems Incorporated How does one center an alert? I'm using Think C. Thanks, Jim Ryan +++++++++++++++++++++++++++ From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) Date: 13 May 92 04:28:52 GMT Organization: University of Waikato, Hamilton, New Zealand In article <1992May12.204311.27370@adobe.com>, jryan@adobe.com (Jim Ryan) writes: > How does one center an alert? I'm using Think C. Congratulations! You've discovered the main reason for giving up on ALRTs, and using DLOGs exclusively. Lawrence resident VideoBigot and QuickTime enthusiast +++++++++++++++++++++++++++ From: phils@chaos.cs.brandeis.edu (Phil Shapiro) Date: 13 May 92 14:26:54 GMT Organization: Symantec Corp. In article <1992May13.162852.8062@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes: In article <1992May12.204311.27370@adobe.com>, jryan@adobe.com (Jim Ryan) writes: > How does one center an alert? I'm using Think C. Congratulations! You've discovered the main reason for giving up on ALRTs, and using DLOGs exclusively. Hmm, I'm not sure what you mean by this -- both DLOGs and ALRTs can be centered using the same code. If you're using THINK C, you can use the PositionDialog() routine in TBUtilities.c, which is provided with the TCL. -phil - -- Phil Shapiro Software Engineer Language Products Group Symantec Corporation Internet: phils@cs.brandeis.edu +++++++++++++++++++++++++++ From: mxmora@unix.SRI.COM (Matt Mora) Date: 14 May 92 01:54:00 GMT Organization: SRI International, Menlo Park, California In article <1992May13.162852.8062@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes: >In article <1992May12.204311.27370@adobe.com>, jryan@adobe.com (Jim Ryan) writes: >> How does one center an alert? I'm using Think C. > >Congratulations! You've discovered the main reason for giving up on ALRTs, >and using DLOGs exclusively. Huh? Whats the problem in centering alerts? Read in the alert info change the coordinates and then call alert. What's so hard about that? If your using system seven just set the bits with resedit. I'm at the WWDC so I can't post the code to show you how to do this but it is pretty trival. Matt - -- ___________________________________________________________ Matthew Mora | my Mac Matt_Mora@sri.com SRI International | my unix mxmora@unix.sri.com ___________________________________________________________ +++++++++++++++++++++++++++ From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) Date: 14 May 92 03:04:22 GMT Organization: University of Waikato, Hamilton, New Zealand In article <PHILS.92May13092654@chaos.cs.brandeis.edu>, phils@chaos.cs.brandeis.edu (Phil Shapiro) writes: > In article <1992May13.162852.8062@waikato.ac.nz> ldo@waikato.ac.nz > (Lawrence D'Oliveiro, Waikato University) writes: > > In article <1992May12.204311.27370@adobe.com>, jryan@adobe.com (Jim > Ryan) writes: > > How does one center an alert? I'm using Think C. > > Congratulations! You've discovered the main reason for giving up on > ALRTs, and using DLOGs exclusively. > > Hmm, I'm not sure what you mean by this -- both DLOGs and ALRTs can be > centered using the same code. If you're using THINK C, you can use the > PositionDialog() routine in TBUtilities.c, which is provided with the > TCL. Thanks for the clarification about code provided with THINK C. My point was how you'd implement these sorts of things with Toolbox-level manipulations; with a DLOG, I can define it to be initially invisible, retrieve the global window bounds from the resource handle, calculate a new position, and then do a MoveWindow followed by a ShowWindow to make it appear in the right place. With an ALRT, I'd have to poke a new window bounds rectangle into the resource handle in memory before bringing up the alert, which is the sort of thing I prefer not to do. Lawrence Born-again Modula-2ist +++++++++++++++++++++++++++ From: buckeye@spf.trw.com (John Wallace) Organization: TRW Data Systems Center, Redondo Beach, CA Date: Thu, 14 May 92 19:41:32 GMT In article <1992May13.162852.8062@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes: >In article <1992May12.204311.27370@adobe.com>, jryan@adobe.com (Jim Ryan) writes: >> How does one center an alert? I'm using Think C. > >Congratulations! You've discovered the main reason for giving up on ALRTs, >and using DLOGs exclusively. > >Lawrence >resident VideoBigot and QuickTime enthusiast Do something like this: function CenteredAlert(alertId:Integer; filterProc:ProcPtr):Integer; var alert : AlertTHndl; hSize, vSize : Integer; screenBounds : Rect; begin (* Load the alert resource and compute is size on the screen *) alert := AlertTHndl(GetResource('ALRT', alertId)); hSize := alert^^.boundsRect.right - alert^^.boundsRect.left; vSize := alert^^.boundsRect.bottom - alert^^.boundsRect.top; (* Comptute the center of the main screen *) screenBounds := GetMainDevice^^.gdRect; hCenter := (screenBounds.left + screenBounds.right) div 2; vCenter := (screenBounds.top + screenBounds.bottom) div 2; (* Set the alert's bounds so it will be centered on the main screen *) alert^^.boundsRect.left := hCenter - (hSize div 2); alert^^.boundsRect.right := alert^^.boundsRect.left + hSize; alert^^.boundsRect.top := vCenter - (vSize div 2); alert^^.boundsRect.top := alert^^.boundsRect.left + vSize; (* Bring up the alert. When Alert calls GetResource it will * find the info we just set in the alert's resource. Note * that this info is only in memory; it won't be written * to disk unless we called ChangeResource and then * write it to disk using WriteResource. (You probably don't * want to write the info to disk, since the whole point * is to properly position the Alert on any display system.) *) CenteredAlert := Alert(alertId, filterProc) end; (Sorry in advance for any typos. I don't have a Mac handy to test this code on.) Cheers! John - --- John Wallace buckeye@spf.trw.com +++++++++++++++++++++++++++ From: mauser@intercon.com (Richard Chandler) Date: 16 May 92 03:01:16 GMT Organization: InterCon Systems Corporation {Code example deleted} If you know you're going to use this technique, you can save yourself a little computation by putting the topleft of the alert at (0, 0), then the bottom and right coordinates give you your width and height. I think there was a human interface guidline that suggested not exactly centering the alert, but theoretically having the top aligned with an imaginary line 1/3 of the way down the screen. Aesthetically that's a bit bette anyway. - -- Praying for the day when "Sex Scandal" is an oxymoron. "Ride a motorcycle. Save Gas, Oil, Rubber, Steel, Aluminum, Parking Spaces, The Environment, and Money. Plus, you get to wear all the leather you want!" Rich Chandler, DoD #296 +++++++++++++++++++++++++++ From: nilesinc@well.sf.ca.us (Avi Rappoport) Date: 18 May 92 23:48:42 GMT Organization: Whole Earth 'Lectronic Link John Wallace buckeye@spf.trw.com Did a good job with this, and his code should work. It's easy to change it to 1/3 of the way down the screen. 2 problems: 1) How do you decide which is the "active" screen? It's either the location of the majority of the active window, or the screen on which the cursor is located -- I never got a chance to test this with users. 2) You have to cope with Radius etc. monitors, which change screenbits. bounds and create a region rather than a rect. I have some code somewhere, but again, never got to test it. Anyone else? - -- - -- Ask me about EndNote and EndNote Plus Bibliography Makers -- Avi Rappoport 2000 Hearst, Berkeley, CA 94709 nilesinc@well.sf.ca.us, 510-649-8176 Niles.Assoc on AppleLink fax: 510-649-8179 +++++++++++++++++++++++++++ From: buckeye@spf.trw.com (John Wallace) Organization: TRW Data Systems Center, Redondo Beach, CA Date: Tue, 19 May 92 22:07:07 GMT In article <nilesinc.706232922@well.sf.ca.us> nilesinc@well.sf.ca.us (Avi Rappoport) writes: > >2) You have to cope with Radius etc. monitors, which change screenbits. >bounds and create a region rather than a rect. I have some code somewhere, >but again, never got to test it. > I haven't been able to test the code on Radius monitors, so I don't know whether the original code will work on them for certain. However, in the code, I get the main graphics device and then find its bounds rect. (The main graphics device is the one with the menubar on it.) I would guess that Radius sets up its GWorlds properly, otherwise all sorts of things would fail on their monitors. Does anyone know for certain?? Thanks John - ---- John Wallace buckeye@spf.trw.com +++++++++++++++++++++++++++ From: nilesinc@well.sf.ca.us (Avi Rappoport) Date: 20 May 92 22:16:52 GMT Organization: Whole Earth 'Lectronic Link In <2A197C0B.9B8@deneva.sdd.trw.com> buckeye@spf.trw.com (John Wallace) writes: >I haven't been able to test the code on Radius monitors, so I don't >know whether the original code will work on them for certain. >However, in the code, I get the main graphics device and then find >its bounds rect. (The main graphics device is the one with the >menubar on it.) I would guess that Radius sets up its GWorlds >properly, otherwise all sorts of things would fail on their >monitors. Does anyone know for certain?? Nope. Radius doesn't use GWorlds at all, just screenbits.bounds. I think this is because non-color-capable (color-incapable?) Macs don't have GWorlds. And things do fail. Avi (space added to fool fascist news program) - -- - -- Ask me about EndNote and EndNote Plus Bibliography Makers -- Avi Rappoport 2000 Hearst, Berkeley, CA 94709 nilesinc@well.sf.ca.us, 510-649-8176 Niles.Assoc on AppleLink fax: 510-649-8179 --------------------------- From: jryan@adobe.com (Jim Ryan) Subject: Fun with FindFolder Date: 15 May 92 18:24:50 GMT Organization: Adobe Systems Incorporated OK, my prefs code is getting close. A BIG thanks to all who have given me all the great feedback! I went the resource route, but now FindFolder is giving me fits. FindFolder returns the blessed System volume number and the "directory ID," right? My code will currently save and retrieve the Prefs file to the blessed System Folder under System 6, however passing the FindFolder results to SetVol(theDirID, theSysVRefNum) puts my prefs file in the same folder as my app when running 7.0. What am I doing wrong? Below is part of my code: - ------------------------------------------------------------------------------ // this is the struct where I store the pref values //-------------------------------------------------- typedef struct { int cp, tp, in, cm, clear, position, horiz, vert; } prefSettings; extern prefSettings gPrefStruct; // this is the function that writes the prefs out //-------------------------------------------------- void WritePrefs(void) // write out prefs file before quiting { OSErr theError; SysEnvRec SysEnvData; int theSysVRefNum, theDirID, theFileRefNum; Handle resHandle; // set Handle to struct size resHandle = NewHandle(sizeof(gPrefStruct)); // get system data theError = SysEnvirons(1, &SysEnvData); if (theError == noErr) { // if System 7 if (SysEnvData.systemVersion >= 0x0700) { // find Preference folder FindFolder(kOnSystemDisk, kPreferencesFolderType, kCreateFolder, &theSysVRefNum, &theDirID); SetVol(theDirID, theSysVRefNum); } else { theSysVRefNum = SysEnvData.sysVRefNum; SetVol(nil, theSysVRefNum); } // always remove old prefs FSDelete("\pThe Prefs", theSysVRefNum); // always create new prefs file theError = Create("\pThe Prefs", theSysVRefNum, 'ABCD', 'pprf'); //create resource fork in the prefs file CreateResFile("\pThe Prefs"); if (theError == noErr) { // open prefs file theFileRefNum = OpenResFile("\pThe Prefs"); // add a resourse to the prefs file AddResource(resHandle, 'STUF', 128, "\prefs"); if (ResError() == 0) { // get the resource so we can play with it resHandle = GetResource('STUF', 128); // toss the prefs struct info into the resource HLock(resHandle); BlockMove((Ptr)&gPrefStruct, *resHandle, (long) sizeof(prefSettings)); HUnlock(resHandle); // let the resource manager know we're done playing ChangedResource(resHandle); WriteResource(resHandle); // close the prefs resource file CloseResFile(theFileRefNum); } } } } // and this is the function that gets the prefs //--------------------------------------------------- void GetPrefs(void) // gets prefs from prefs file { OSErr theError; SysEnvRec SysEnvData; int theSysVRefNum, theDirID, theFileRefNum; Handle resHandle; // get blessed System Folder theError = SysEnvirons(1, &SysEnvData); if (theError == noErr) { // if System 7 if (SysEnvData.systemVersion >= 0x0700) { // find Preference folder FindFolder(kOnSystemDisk, kPreferencesFolderType, kCreateFolder, &theSysVRefNum, &theDirID); SetVol(theDirID, theSysVRefNum); } else { theSysVRefNum = SysEnvData.sysVRefNum; SetVol(nil, theSysVRefNum); } // open prefs file theFileRefNum = OpenResFile("\pThe Prefs"); if (theFileRefNum != -1) { // get the resource so we can play with it resHandle = GetResource('STUF', 128); if (resHandle != nil) { // get info from the resource and place it in the prefs struct HLock(resHandle); BlockMove(*resHandle, (Ptr)&gPrefStruct, (long) sizeof(prefSettings)); HUnlock(resHandle); } else { TheErrorHandler(PREFS_ERROR); SetDefaults(); } // close the prefs file CloseResFile(theFileRefNum); // check and make sure we got good data DoPrefsCheck(); } // if no prefs file, or problem, set defaults else { SetDefaults(); } } // if SysEnvirons returns error, then so do we else { TheErrorHandler(SYSTEM_ERROR); } } - ------------------------------------------------------------------------------ Any suggestons to clean this code up would also be greatly appreciated. Thanks again, jr +++++++++++++++++++++++++++ From: keith@taligent.com (Keith Rollin) Date: 19 May 92 23:16:32 GMT Organization: Taligent In article <1992May15.182450.3530@adobe.com>, jryan@adobe.com (Jim Ryan) writes: > > > OK, my prefs code is getting close. A BIG thanks to all who have given > me all the great feedback! I went the resource route, but now > FindFolder is giving me fits. > > FindFolder returns the blessed System volume number and the > "directory ID," right? My code will currently save and retrieve > the Prefs file to the blessed System Folder under System 6, however > passing the FindFolder results to SetVol(theDirID, theSysVRefNum) puts my > prefs file in the same folder as my app when running 7.0. > What am I doing wrong? Below is part of my code: > > [ code deleted ] > > Any suggestons to clean this code up would also be greatly appreciated. > I don't know what's going wrong, but I wouldn't bother even trying to find out. Just get rid of the call to SetVol. You don't need it, and it's obviously causing you problems. Get rid of it and call HOpenResFile and HCreateResFile instead. - -- Keith Rollin Phantom Programmer Taligent, Inc. --------------------------- From: Justin Harvey Subject: Think C 4 & 5 Date: 15 May 92 21:39:56 GMT Organization: University of Alaska, Southeast I am a High School C Programmer here at Juneau-Douglas High School and my computer lab teacher has TC 4.5 which is the System 7 comp. version. I was wondering if there is an update package for 4 -> 5 and if so is it worth changing? Thanks, Justin Harvey +++++++++++++++++++++++++++ From: jerry@uni-paderborn.de (Gerald Siek) Date: 20 May 92 11:31:37 GMT Organization: Uni-GH Paderborn Justin Harvey writes: >I am a High School C Programmer here at Juneau-Douglas High School and my >computer lab teacher has TC 4.5 which is the System 7 comp. version. >I was wondering if there is an update package for 4 -> 5 and if so is it worth >changing? >I am a High School C Programmer here at Juneau-Douglas High School and my >computer lab teacher has TC 4.5 which is the System 7 comp. version. >I was wondering if there is an update package for 4 -> 5 and if so is it worth >changing? There is ... and it's worth buying (sorry, update 4 -> 5 isn't free). Version 5 eliminates quite some bugs and memory restrictions. It has a lot more compiler-, language- and optimization options. I was porting a HUGE and complicated UNIX program with version 4 and it simply failed because of the memory limitations. With version 5 all runs fine, especially the debugger can now handle the whole code (330.000 lines) with no problems. Jerry - -- Gerald Siek - jerry@uni-paderborn.de - University of Paderborn, Germany --------------------------- From: kresch@vu-vlsi.vill.edu (Ed Kresch) Subject: SetLineWidth question Date: 19 May 92 15:44:46 GMT Organization: Villanova University I have a question about SetLineWidth and the explanation of it given in Technical Note 175. According to my understanding of TN175, the C program shown below should draw a thin line, a thick line, and a thin line. What it does is draw a thin line and two thick lines. Did I misunderstand the technical note or is there an error somewhere? theWidth = (Point**)NewHandle (sizeof (Point)); /* Draw a horizontal line of 1 point thickness */ SetPt (*theWidth, 1, 1); PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); PenSize (1, 1); MoveTo (100, 100); LineTo (500, 100); /* Draw a horizontal line of 5 point thickness */ SetPt (*theWidth, 1, 5); PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); MoveTo (100, 200); LineTo (500, 200); /* Draw a horizontal line of 1 point thickness */ SetPt (*theWidth, 1, 1); PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); PenSize (1, 1); MoveTo (100, 300); LineTo (500, 300); DisposHandle (theWidth); I am using a Mac II and system 6.0.5. Thanks. Ed Kresch +++++++++++++++++++++++++++ From: unity@mcl.mcl.ucsb.edu (Pete Gontier) Date: 20 May 92 17:26:36 GMT In <1992May19.154446.11416@vu-vlsi.vill.edu> kresch@vu-vlsi.vill.edu (Ed Kresch) writes: >I have a question about SetLineWidth and the explanation of it given in >Technical Note 175. According to my understanding of TN175, the C program >shown below should draw a thin line, a thick line, and a thin line. What it >does is draw a thin line and two thick lines. Did I misunderstand the >technical note or is there an error somewhere? > SetPt (*theWidth, 1, 5); > PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); > /* draw stuff */ > SetPt (*theWidth, 1, 1); > PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); > /* draw stuff */ >I am using a Mac II and system 6.0.5. It's not your machine or your System version. It's not even the version of your printer driver. It's a problem at the driver level. Different drivers do different things with this comment. Don't ask me why; Zz keeps threatening to write a tech note about it; I think he actually did write something recently, perhaps in d e v e l o p. Your code needs to look like this: /* group one */ SetPt (*theWidth, 1, 5); PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); /* draw stuff */ /* group two */ SetPt (*theWidth, 5, 1); PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); /* draw stuff */ /* group three */ SetPt (*theWidth, 1, 1); PicComment (SetLineWidth, sizeof (Point), (Handle)theWidth); /* draw stuff */ Group one sets the line width to what you want. Group two sets it back to its original size for some printers. Group three sets it back to its original size for the others (and doesn't affect the group 2 printers, since they're already at 1,1). I consider this a bug, but then the differences between MemError, ResError, and QDError are a bug as far as I'm concerned, so I'm a weenie. - -- Pete Gontier // EC Technology // unity@mcl.ucsb.edu --------------------------- From: johnwl@kean.ucs.mun.ca Subject: Image measurement for the Mac ?? Organization: Memorial University. St.John's Nfld, Canada Date: Thu, 21 May 1992 14:22:46 GMT Hello ! could anyone on this group supply me with information regarding an image MEASUREMENT system I could use on digitized photographs on a Macintosh computer ? I am looking for PD/Shareware or commercial software that will permit me to measure scanned pictures (in TIFF or PICT or GIF format) of fish otoliths (ear bones) to within at least 0.1 mm. There are commercial packages for the PC that will do this (Optimus, for example), but I would rather not spend $20K just to get this system on-line ! Surely there is something I could use for the Mac ?? I have access to colour or black and white, and have tried Image 3.1.1 and MacMeasure to no avail. Any help with this would be greatly appreciated ! regards, Jack johnwl@kean.ucs.mun.ca +++++++++++++++++++++++++++ From: des7f@fulton.seas.Virginia.EDU (David E. Sappington) Organization: University of Virginia Date: Thu, 21 May 1992 15:42:57 GMT In article <1992May21.105246.1@kean.ucs.mun.ca> johnwl@kean.ucs.mun.ca writes: [ wants to measure stuff in scanned images ] I haven't used it extensively (and never for measuring stuff) but you might want to check out Image 1.44 by Wayne Rasband at NIH. It's available via anon-ftp from alw.nih.gov (128.231.128.7) in pub/image. The Pascal source code is there as well so that you can add functionality if necessary. Dave Sappington des7f@virginia.edu Institute for Parallel Computation des7f@virginia.bitnet University of Virginia --------------------------- From: olsone@vccsouth08.its.rpi.edu (Erik G. Olson) Subject: Are "virtual" (software) monitors possible? Organization: Rensselaer Polytechnic Institute, Troy NY Date: Sat, 16 May 1992 06:25:34 GMT Hi. I'm rather new to programming the Macintosh, and was wondering if anyone would comment on what I would need to learn about to pull off a (rather silly) system hack: Let's say I have a graphics device hooked up to my serial port. Never mind how it works; just suppose one can write Mac programs that put bitmapped graphics onto it, make it do drawing primitives, etc. Now, my question is, how could you fool the operating system into thinking that there actually existed a monitor out there that had to be dealt with by making calls to our special software that controls this graphics device? And how could we make this usable as part of the desktop? Is this crazy or what? - -- Erik G. Olson =+ Where am I? Tell the truth-- olsone@rpi.edu =+ I can bear it. In what quarter of the globe =+ Have I descended like a meteorite? =+ ---Cyrano de Bergerac, Act III +++++++++++++++++++++++++++ From: absurd@applelink.apple.com (Tim Dierks, software saboteur) Date: 20 May 92 03:09:41 GMT Organization: MacDTS Misfits In article <9!3v6vl@rpi.edu>, olsone@vccsouth08.its.rpi.edu (Erik G. Olson) writes: > Hi. I'm rather new to programming the Macintosh, and was wondering if > anyone would comment on what I would need to learn about to pull off > a (rather silly) system hack: > > Let's say I have a graphics device hooked up to my serial port. Never > mind how it works; just suppose one can write Mac programs that > put bitmapped graphics onto it, make it do drawing primitives, etc. > > Now, my question is, how could you fool the operating system into > thinking that there actually existed a monitor out there that had > to be dealt with by making calls to our special software that > controls this graphics device? And how could we make this usable > as part of the desktop? Well.... Yes and no. In QuickDraw, monitors are not really "devices"- they're frame buffers. This means that QuickDraw doesn't make calls to you that you can translate in order to pass the data to your device; it just attempts to blast everything into a chunk of memory you have spoecified as your screen memory. (This isn't 100% true, but it's probably close enough for the moment.) Therefore, the only thing you can do is provide a buffer for QuickDraw to image into, then pump the buffer over the serial line to your device. You can find out when & where QuickDraw is drawing to your device by patching ShieldCursor and ShowCursor; all drawing is bracketed by calls to these traps. Best of luck. Tim Dierks MacDTS, but I speak for myself --------------------------- From: iron@imag.fr (Francois Menneteau) Subject: detecting when a volume or floppy is mounted, how? Date: 18 May 92 16:30:10 GMT Organization: IMAG Institute, University of Grenoble, France I have an application that gets the mounted volume and displays them. However, if a volume is mounted after the application is launched, the application is no information about this volume, and so the user cannot select files from it. I think by patching traps like PBMountVol to notify my application can be a solution. However each time Apple will release a new trap that mounts vol, I will be obliged to build again my application. An other solution, would be to regularly get the list of all the mounted volume, but I'd like to avoid this solution (it is time consuming, not very logical, and implies code to compare the new volumes list to the old one). So, has anybody a good (and esthetic :-)) solution to my problem? - -- Francois Menneteau () __|||||__ () "... I had their lives in my hands ================== () /O O\ () their fate their fortune in my visions iron@imag.fr () - .|. - () No one believed in my true prophecy ================== () \=^=/ () And now it's too late." (Iron Maiden) +++++++++++++++++++++++++++ From: REEKES@applelink.apple.com (Jim Reekes) Date: 19 May 92 19:51:51 GMT Organization: Apple Computer, Inc. In article <34440@imag.imag.fr>, iron@imag.fr (Francois Menneteau) writes: > > > I have an application that gets the mounted volume and displays them. However, > if a volume is mounted after the application is launched, the application is > no information about this volume, and so the user cannot select files from it. > > I think by patching traps like PBMountVol to notify my application can be a > solution. However each time Apple will release a new trap that mounts vol, > I will be obliged to build again my application. > > An other solution, would be to regularly get the list of all the mounted > volume, but I'd like to avoid this solution (it is time consuming, not very > logical, and implies code to compare the new volumes list to the old one). > > So, has anybody a good (and esthetic :-)) solution to my problem? You can poll in your event loop (not every time, but every couple seconds) for additional volumes that have been mounted. Just use the indexed calls to find information about volumes. This *isn't* time consuming, and it's also the logical choice. You don't have to patch anything. You're already maintaining the list of vRefNums and the volume name which is a small amount of data you can keep in an array. The volume name is limited to a Str27, so you can keep the size of the array pretty small. This list will also be fast to search since it's only going to contain a few items. 20 volumes would be a big list, but a linear search will be very fast. - ----------------------------------------------------------------------- Jim Reekes, Polterzeitgeist | Macintosh Toolbox Engineering | Sound Manager Expert Apple Computer, Inc. | "All opinions expressed are mine, and do 20525 Mariani Ave. MS: 81-KS | not necessarily represent those of my Cupertino, CA 95014 | employer, Apple Computer Inc." +++++++++++++++++++++++++++ From: keith@taligent.com (Keith Rollin) Date: 19 May 92 23:04:14 GMT Organization: Taligent In article <34440@imag.imag.fr>, iron@imag.fr (Francois Menneteau) writes: > > > I have an application that gets the mounted volume and displays them. However, > if a volume is mounted after the application is launched, the application is > no information about this volume, and so the user cannot select files from it. > > I think by patching traps like PBMountVol to notify my application can be a > solution. However each time Apple will release a new trap that mounts vol, > I will be obliged to build again my application. > > An other solution, would be to regularly get the list of all the mounted > volume, but I'd like to avoid this solution (it is time consuming, not very > logical, and implies code to compare the new volumes list to the old one). > > So, has anybody a good (and esthetic :-)) solution to my problem? I would use your second solution. Patching PBMountVol will only work if your application is active when PBMountVol is called. Similarly, disk-inserted events are sent only to the frontmost application. Checking for new volumes by polling shouldn't be that bad. First, start with the following data structure: struct MountedVolume { Str31 name; long creationDate; Boolean mark; struct MountedVolume* next; }; Using this, you can create a list of mounted volumes (store the creation date of the volume to differentiate between identically named volumes). You can then iterate over the list of currently mounted volumes, finding new entries that you don't know about. Using the "mark" variable, you can use a mark-and-sweep technique for detecting entries in your list that refer to now unmounted volumes. I usually keep 3 or 4 volumes mounted at a time at work. Making 3 to 16 string comparisons shouldn't make much of an impact if you resync once a second or so. I think that there is a low-memory vector that the File System calls when a volume is mounted. However: a) I don't think this vector is documented b) I don't know if it's swapped when your application is swapped out c) I don't know if it's called when a volume is unmounted. So it's probably not a good idea to use this vector if it indeed exists. - -- Keith Rollin Phantom Programmer Taligent, Inc. --------------------------- From: dowlr@WFUNET.WFU.EDU (Ramsey Dow) Subject: Two questions Date: 20 May 92 14:04:32 GMT Organization: Department of Redundancy Department I have two questions for the readership of comp.sys.mac.programmers: 1. Exactly how long is a Mac ms? Is it precisely 1 ms? A Mac K is 1024 bytes, not 1000. Is there a similar difference between a ms and a Mac ms? 2. Does the event loop slow down an application's ability to process data through a hardware interface? Please respond by email, as I do not read this group very often. If I get some good answers I will post a summary. Thank you in advance. Ramsey Dow - -- Ramsey Dow Internet: dowlr@wfu.edu -or- dowlr@ac.wfunet.wfu.edu Nyarlathotep..the crawling chaos..I am the last..I will tell the audient void. +++++++++++++++++++++++++++ From: jcav@quads.uchicago.edu (JohnC) Date: 20 May 92 17:28:07 GMT Organization: The Royal Society for Putting Things on Top of Other Things In article <9205201420.AA03430@ucbvax.Berkeley.EDU> dowlr@WFUNET.WFU.EDU (Ramsey Dow) writes: >I have two questions for the readership of comp.sys.mac.programmers: > >1. Exactly how long is a Mac ms? Is it precisely 1 ms? A Mac K is 1024 bytes, > not 1000. Is there a similar difference between a ms and a Mac ms? One kilobyte is defined to be two to the 10th power, or 1024. This isn't Mac-specific. In ancient times, the Finder used to report disk space and file sizes in units of 1000 bytes, and called these units "K"s, but this has long since been changed to conform to the standard definition. So, a "Mac K" _used to be_ 1000, but now it's 1024. As for "Mac milliseconds", as far as I know they're standard real milliseconds. :-) >2. Does the event loop slow down an application's ability to process data > through a hardware interface? If you mean, does the event loop affect interrupt response, then the answer is no. I'm not sure what you mean, though. - -- John Cavallino | EMail: jcav@midway.uchicago.edu University of Chicago Hospitals | John_Cavallino@uchfm.bsd.uchicago.edu Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953 B0 f++ c+ g+ k s++ e+ h- pv | Chicago, IL 60637 --------------------------- From: kevin@crash.cts.com (Kevin Hill) Subject: HOW do I get the finder to update its file information.. Date: 21 May 92 23:12:46 GMT Organization: Crash TimeSharing, El Cajon, CA I have changed the name of a file with one of my programs. The file itself happens to be in a window that is open. When I switch to the finder to delete the file that is open, I get a "File not found error" I am assuming that the finder has not updated its file information since I changed the name and thus is trying to delete a filename that no longer exists. Is there a way to send the finder an event that will tell it to update its file information after I change a file name? any help would be appeciated.. Thanks everyone! Kevin Hill +++++++++++++++++++++++++++ From: dickie@schaefer.math.wisc.edu (Garth Dickie) Date: 22 May 92 01:44:27 GMT Organization: Univ. of Wisconsin Dept. of Mathematics You need to change the modification date of the parent directory. The routine TickleParent below works for me. In case you are not using the FSSpec structure, the routine MakeWDSpec will convert a working directory / filename pair to a psuedo-FSSpec. I use this when the new file manager calls are not available, as the rest of my code passes around FSSpecs. The code compiles under THINK C 5.0, with the usual headers. BTW (mild flame) this is simple enough that it's pretty annoying when people don't do it. Most of the nifty little 'drag-and-drop' utilities that have come around recently forget to do this. Feel free to use the code below in any way you see fit. OSErr TickleParent( FSSpec * child ) { CInfoPBRec pb; OSErr err = noErr; pb.dirInfo.ioCompletion = 0; pb.dirInfo.ioNamePtr = 0; pb.dirInfo.ioVRefNum = child->vRefNum; pb.dirInfo.ioFDirIndex = -1; // get info based on the DirID pb.dirInfo.ioDrDirID = child->parID; if(( err = PBGetCatInfoSync( &pb )) != noErr ) return err; GetDateTime( &pb.dirInfo.ioDrMdDat ); err = PBSetCatInfoSync( &pb ); return err; } OSErr MakeWDSpec( FSSpec *spec, short vRefNum, ConstStr255Param name ) { WDPBRec parameter; Size length; OSErr err; parameter.ioCompletion = 0; parameter.ioNamePtr = 0; parameter.ioVRefNum = vRefNum; parameter.ioWDIndex = 0; parameter.ioWDProcID = 0; parameter.ioWDVRefNum = 0; err = PBGetWDInfoSync( ¶meter ); spec->vRefNum = parameter.ioWDVRefNum; spec->parID = parameter.ioWDDirID; length = MIN( *name, sizeof spec->name - 1 ); BlockMove( name + 1, spec->name + 1, length ); *spec->name = length; return err; } - -- garth dickie -- dickie@math.wisc.edu -- math agnostic (and student) --------------------------- From: gft_robert@gsbacd.uchicago.edu (opcode ranger) Subject: Need Graphics Book Rec Date: 18 May 92 22:07:25 GMT I'm a self-taught Mac programmer and I'd like to get a good book that will give me some background on computer graphics (y'know, the really cool stuff like in Terminator 2! :->). What's a good introductory but non-puffy book? I seem to remember that there is supposedly some standard text by "Van" someone, or no? Is that any good? I'd like something with good depth and background, but something that will also help me learn quickly. Replies by e-mail would be much appreciated, since my phone link to this newssite is rather expensive. Thanks! Robert - -- ============================================================================== = gft_robert@gsbacd.uchicago.edu * "Out there on a darkened road, the lights = = are dead and the cars explode" -- "Good Things", Sisters of Mercy = ============================================================================== +++++++++++++++++++++++++++ From: rjacks@austlcm.sps.mot.com (rodney jacks) Organization: Motorola Inc, Austin, Texas Date: Tue, 19 May 1992 20:14:12 GMT In article <1992May18.160725.1@gsbacd.uchicago.edu> gft_robert@gsbacd.uchicago.edu (opcode ranger) writes: >I'm a self-taught Mac programmer and I'd like to get a good book that will >give me some background on computer graphics (y'know, the really cool stuff >like in Terminator 2! :->). > >What's a good introductory but non-puffy book? I seem to remember that there >is supposedly some standard text by "Van" someone, or no? Is that any good? >I'd like something with good depth and background, but something that will also >help me learn quickly. The book I think you are referring to is "Computer Graphics" by Foley and VanDam (sp?). While it is a good college-level textbook book, I don't think it one to learn quickly from... *********************************************************************** ** Rodney Jacks ** ** Motorola Inc, Austin, Texas ** ** E-mail: rjacks@austlcm.sps.mot.com ** ** Picard asks Worf what he thought of commanding the _Enterprise_ ** ** "Comfortable chair." ST.TNG _The Emissary_ ** *********************************************************************** +++++++++++++++++++++++++++ From: fritsch@fsinfo.cs.uni-sb.de (Lothar Fritsch) Date: 21 May 92 07:30:38 GMT Organization: Fachschaft Informatik, U of Saarland, FRG The book you mean is: Computer Graphics - Principles and Practice by Foley, van Dam & others. Addison-Wesley #12110 It has about 1200 pages, lots of color images, and lots of stuff to read. But if you want a book to quickly learn and look up algorithms, it isn't a book for you. They write very extensive about the foudations of computer graphics, from CRT to radiosity, but more under the aspect of 'how does it work' instead of 'here are the algorithms'. Yours, Lothar Fritsch - -- Lothar Fritsch, Student der Universitaet des Saarlandes, Fachb. Informatik e-mail: fritsch@fsinfo.cs.uni-sb.de phone: (ger) 06821-72562 "You don't have to sleep to see nightmares." - (Anne Clarke) --------------------------- End of C.S.M.P. Digest **********************